package com.lwlk.zdk.service.Task;

import com.lwlk.zdk.Timer.AddPostCheckTask;
import com.lwlk.zdk.mapper.pw.pwCheckTheDutyMessageMapper;
import com.lwlk.zdk.service.PostService.impl.PostMessageServiceImpl;
import com.lwlk.zdk.service.Task.impl.TaskServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Timer;

@Service
public class TimeService {

    @Autowired
    private PostMessageServiceImpl postMessageServiceImpl;

    public void CreateCheckTime(Date date, int id) {
        Timer t = new Timer(); // 建立Timer对象
        AddPostCheckTask task = new AddPostCheckTask(id, postMessageServiceImpl); //创建查岗时间定义任务
        t.schedule(task, date);
    }

    public void updateOnInspectionTime(Date date, int id) {
        Timer t = new Timer(); // 建立Timer对象
        AddPostCheckTask task = new AddPostCheckTask(id, postMessageServiceImpl); //更新查岗时间定义任务
        t.schedule(task, date);
    }
}
